import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-root',
  templateUrl: 'app.component.html',
  styleUrls: ['app.component.scss'],
})
export class AppComponent implements OnInit {
  dragPosition = {x: 0, y: 0};


  ngOnInit(): void {
    let coordinate = localStorage.getItem('coordinate');
    if (!coordinate) {
      coordinate = '{"x":0,"y":0}';
    }
    this.dragPosition = JSON.parse(coordinate);
  }

  dragEnd(r: any) {
    localStorage.setItem('coordinate', JSON.stringify(r.source.getFreeDragPosition()));
  }
}
